package com.adnaan.restaurant.common.untils;

import com.github.pagehelper.PageInfo;

/**
 * author: adnaan
 * create: 2023-12-13 14:16
 * Description:
 */
public class PageUtils {
    //将分页信息封装到统一的接口
    public static PageResult getPageResult(PageInfo<?> pageInfo) {
        PageResult pageResult = new PageResult();
        pageResult.setPageNum(pageInfo.getPageNum());
        pageResult.setPageSize(pageInfo.getPageSize());
        pageResult.setTotalSize(pageInfo.getTotal());
        pageResult.setTotalPages(pageInfo.getPages());
        pageResult.setContent(pageInfo.getList());
        return pageResult;
    }
}
